home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Storage / Bento / EmbedHdr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  4.0 KB  |  132 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        EmbedHdr.h
  3.  
  4.     Contains:    ODEmbbeddedHandlers header
  5.  
  6.     Written by:    Vincent Lo
  7.  
  8.     Copyright:    © 1993-1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <6>     8/16/95    EL        1242376: Buffer embedded handler so there
  13.                                     is less fragmentation on top level
  14.                                     container.
  15.          <5>      5/2/95    EL        1245113: Turn off buffering because it
  16.                                     currently cause problem in this bug.
  17.          <4>     4/25/95    EL        1213321: turn on embedded container
  18.                                     buffering.
  19.          <3>      4/7/95    EL        1213321: New buffering scheme but leave it
  20.                                     inactivated until after DR2.
  21.          <2>     8/26/94    EL        #1182275 Allows writing embeded value in
  22.                                     large block to decrease fragmentation.
  23.          <1>     5/27/94    VL        first checked in
  24.  
  25.     To Do:
  26. */
  27.  
  28. #ifndef _EMBEDHDR_
  29. #define _EMBEDHDR_
  30.  
  31. #ifndef _ODTYPES_
  32. #include "ODTypes.h"
  33. #endif
  34.  
  35. #ifndef _BENTOHDR_
  36. #include "BentoHdr.h"
  37. #endif
  38.  
  39. #ifndef __CM_API__
  40. #include "CMAPI.h"
  41. #endif
  42.  
  43. #ifndef __CM_API_TYPES__
  44. #include "CMAPITyp.h"
  45. #endif
  46.  
  47. #ifndef _PLFMDEF_
  48. #include "PlfmDef.h"
  49. #endif
  50.  
  51. #define kLargeEmbeddedBlock 1
  52.  
  53. //==============================================================================
  54. // Theory of Operation
  55. //==============================================================================
  56.  
  57. //==============================================================================
  58. // Constants
  59. //==============================================================================
  60. const    kBentoTypeNameSize = 512;
  61. const    kEmbeddedBlockSize = 2048;
  62. extern const ODType    kODEmbeddedContainerTypeName; // = "EmbedHdr";
  63.  
  64. //==============================================================================
  65. // Scalar Types
  66. //==============================================================================
  67.  
  68. //==============================================================================
  69. // Classes defined in this interface
  70. //==============================================================================
  71. class ODEmbeddedHandlers;
  72.  
  73. //==============================================================================
  74. // Classes used by this interface
  75. //==============================================================================
  76.  
  77. //==============================================================================
  78. // ODEmbeddedHandlers
  79. //==============================================================================
  80.  
  81. class ODEmbeddedHandlers : public ODBentoHandlers
  82. {
  83. public:
  84.  
  85.     ODEmbeddedHandlers(CMSession session, CMValue parentValue);
  86.     ODVMethod ~ODEmbeddedHandlers();
  87.     
  88.     ODMethod void Initialize();
  89.     ODMethod CMSession GetCMSession();
  90.     
  91.     ODMethod CMRefCon OpenHandler(CMOpenMode mode);
  92.     ODMethod void CloseHandler();
  93.     ODMethod CMSize FlushHandler();
  94.     ODMethod CMSize SeekHandler(CM_LONG posOff, CMSeekMode mode);
  95.     ODMethod CMSize TellHandler();
  96.     ODMethod CMSize ReadHandler(CMPtr buffer, CMSize elementSize, CMCount theCount);
  97.     ODMethod CMSize WriteHandler(CMPtr buffer, CMSize elementSize, CMCount theCount);
  98.     ODMethod CMEofStatus EOFHandler();
  99.     ODMethod CMBoolean TruncHandler(CMSize containerSize);
  100.     ODMethod CMSize ContainerSizeHandler();
  101.     ODMethod void ReadLabelHandler(CMMagicBytes magicByteSequence,
  102.                         CMContainerFlags *flags, CM_USHORT *bufSize,
  103.                         CM_USHORT *majorVersion, CM_USHORT *minorVersion,
  104.                         CMSize *tocOffset, CMSize *tocSize);
  105.     ODMethod void WriteLabelHandler(CMMagicBytes magicByteSequence,
  106.                         CMContainerFlags flags, CM_USHORT bufSize,
  107.                         CM_USHORT majorVersion, CM_USHORT minorVersion,
  108.                         CMSize tocOffset, CMSize tocSize);
  109.     ODMethod CMValue ReturnParentValueHandler();
  110.     ODMethod CM_UCHAR* ReturnContainerNameHandler();
  111.     ODMethod CMType ReturnTargetTypeHandler(CMContainer container);
  112.     ODMethod void ExtractDataHandler(CMDataBuffer buffer,
  113.                             CMSize size, CMPrivateData data);
  114.     ODMethod void FormatDataHandler(CMDataBuffer buffer,
  115.                             CMSize size,
  116.                             CMPrivateData data);
  117.  
  118. private:
  119.  
  120.     CMSession    fSession;
  121.     CMValue        fParentValue;
  122.     CMSize        fPosition;
  123.     CMSize        fSize;
  124. #if kLargeEmbeddedBlock
  125.     CMSize        fBufferBegin;
  126.     ODSByte*    fBuffer;
  127. #endif
  128.     ODSByte    fTypeName[kBentoTypeNameSize];
  129.     ODBoolean    fReverseEndian;
  130. };
  131.  
  132. #endif // _EMBEDHDR_